import {createRouter, createWebHashHistory} from 'vue-router'

const router = createRouter({
    history: createWebHashHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            redirect: '/home'
        },
        {
            path: '/home',
            name: 'Home',
            component: () => import('@/views/Home/index.vue')
        },
        {
            path: '/cart',
            name: 'Cart',
            component: () => import('@/views/Cart/index.vue')
        },
        {
            path: '/category',
            name: 'Category',
            component: () => import('@/views/Category/index.vue')
        },
        {
            path: '/user',
            name: 'User',
            component: () => import('@/views/User/index.vue')
        },
        {
            path: '/userDetail',
            name: 'UserDetail',
            component: () => import('@/views/UserDetail/index.vue')
        },
        {
            path: '/detail/:id',
            name: 'Detail',
            component: () => import('@/views/Detail/index.vue')
        },
        {
            path: '/search',
            name: 'Search',
            component: () => import('@/views/Search/index.vue')
        },
        {
            path: '/login',
            name: 'Login',
            component: () => import('@/views/Login/index.vue')
        },
       {path: '/:pathMatch(.*)*', name: 'not-found', redirect: '/home',},
    ]
})

export default router
